package com.haojin.java;

public class Order1 {
	public static void main(String[] args) {
		Order1 order1 = new Order1(1001, "AA");
		Order1 order2 = new Order1(1001, "bb");
		Order1 order3 = new Order1(1001, "bb");
		System.out.println(order1.equals(order2));
		System.out.println(order2.equals(order3));
	}
	private int orderid;
	private String orderName;
	public int getOrderid() {
		return orderid;
	}
	public void setOrderid(int orderid) {
		this.orderid = orderid;
	}
	public String getOrderName() {
		return orderName;
	}
	public void setOrderName(String orderName) {
		this.orderName = orderName;
	}
	public Order1(int orderid, String orderName) {
		super();
		this.orderid = orderid;
		this.orderName = orderName;
	}
	public Order1() {
		super();
	}
	
	@Override
	public boolean equals(Object obj) {
		if(this == obj){
			return true;}
		if(obj instanceof Order1){
			Order1 order = (Order1)obj;
			return this.orderid == order.orderid && this.orderName.equals(order.orderName);
		}
		return false;
		}
//	手动实现
//	public String toString() {
//		return "Order1[orderid =" +orderid+",orderName ="+orderName+"]";
//	}
	@Override
	public String toString() {
		return "Order1 [orderid=" + orderid + ", orderName=" + orderName + "]";
	}

}
